package com.oocl.processdData.server;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
	
	private ServerSocket server;
	private OutputStream out;
	private InputStream in;
	private Socket socket;
	
	public Server() throws IOException {
		server = new ServerSocket(8888);
		
	}

	public void start(){
		try {
			socket = server.accept();
			out = socket.getOutputStream();
			in = socket.getInputStream();
		} catch (IOException e) {
			System.out.println("Server cannot start......");
			e.printStackTrace();
		}
	}
	
	public void end() throws IOException{
		in.close();
		out.close();
		server.close();
		socket.close();
	}

	public ServerSocket getServer() {
		return server;
	}

	public void setServer(ServerSocket server) {
		this.server = server;
	}

	public OutputStream getOut() {
		return out;
	}

	public void setOut(OutputStream out) {
		this.out = out;
	}

	public InputStream getIn() {
		return in;
	}

	public void setIn(InputStream in) {
		this.in = in;
	}

	public Socket getSocket() {
		return socket;
	}

	public void setSocket(Socket socket) {
		this.socket = socket;
	}
	
	

}
